const Router = require('koa-router');
const fs = require('fs');

const hello = new Router();

hello.prefix('/hello');

hello.get('/', async(ctx) => {
    console.log('hello world');
    return ctx.body = 'hello world';
})

hello.get('/koa2/:id', async(ctx) => {
    ctx.type = 'html';
    ctx.response.body = fs.createReadStream('./web/404.html');
})

module.exports = hello;